//
//  Storyboarable.swift
//  CitySearch
//
//  Created by guotonglin on 2020/6/2.
//  Copyright © 2020 guotonglin. All rights reserved.
//

import Foundation
import UIKit

protocol Storyboardable {
    static func instantiate() -> Self
}


extension Storyboardable where Self: UIViewController {
    
    static func instantiate () -> Self {
        let fullName = NSStringFromClass(self)
        let className = fullName.components(separatedBy: ".")[1]
        let storyboard = UIStoryboard(name: "Main", bundle: Bundle.main)
        return storyboard.instantiateViewController(identifier: className)
    }
    
}
